-extends 'layouts/_widget_box.haml'

-block widget_help
  program_directives

-block widget_id
  program_directives_widget

-#block widget_class
  business

-block widget_title
  %i.grcicon-directive
  -if not instance.company_controls
    Directives
    %span.subtitle
      (Regulations, Contracts, Policies) and Controls
  -else
    Controls

-block widget_buttons
  .filter
    .row-fluid
      .span6
        %input.ui-corner-all.widgetsearch-tocontent.clear-value{ 'type': 'text', 'placeholder': 'Search' }
      .span6
        .pull-right
          %a.btn.btn-add{ 'href': 'javascript://', 'data-toggle': 'modal-ajax-form', 'data-modal-reset': 'reset', 'data-form-target': 'refresh', 'data-modal-class': 'modal-wide', 'data-object-singular': 'Control', 'data-object-plural': 'controls' } 
            %i.grcicon-add
            Control
        .pull-right
          -if not instance.company_controls
            .btn-group.left-dropdown.button-space
              %a{ 'data-toggle': "dropdown", 'href': "#", 'class': "btn btn-add dropdown-toggle", 'rel': "tooltip", 'title': "Add/Remove Directives" }
                %i.grcicon-link-white
                Directives
              %ul.dropdown-menu
                %li.add-new-item
                  %a{ 'data-modal-reset': 'reset', 'data-toggle': "modal-ajax-relationship-selector", 'href': "list_edit_flow_program_directives_path(program_id => instance.id, directive_meta_kind => regulation)", 'data-modal-class': 'modal-wide', 'data-child-type': 'directive', 'data-child-meta-type': 'regulation', 'data-child-property': 'directive_id' }
                    %i.grcicon-regulation-color
                    Regulation
                %li.add-new-item
                  %a{ 'data-modal-reset': 'reset', 'data-toggle': "modal-ajax-relationship-selector", 'href': "list_edit_flow_program_directives_path(program_id => instance.id, directive_meta_kind => contract)", 'data-modal-class': 'modal-wide', 'data-child-type': 'directive', 'data-child-meta-type': 'contract', 'data-child-property': 'directive_id' }
                    %i.grcicon-contract-color
                    Contract
                %li.add-new-item
                  %a{ 'data-modal-reset': 'reset', 'data-toggle': "modal-ajax-relationship-selector", 'href': "list_edit_flow_program_directives_path(program_id => instance.id, directive_meta_kind => policy)", 'data-modal-class': 'modal-wide', 'data-child-type': 'directive', 'data-child-meta-type': 'policy', 'data-child-property': 'directive_id' }
                    %i.grcicon-policy-color
                    Policy

-block main
  .tabbable
    %ul.nav.nav-tabs
      -if not instance.company_controls
        %li.text-governance.active
          %a{ 'href': '#directives', 'data-toggle': 'tab', 'data-object-plural': 'directives' }
            %i.grcicon-directive-color
            Directives
      %li.text-governance
        %a{ 'href': '#controls', 'data-toggle': 'tab', 'data-object-plural': 'controls' }
          %i.grcicon-control-color
          Controls

    .action-items
      %a.expandAll.btn.btn-mini{ 'href': "#", 'rel': "tooltip", 'title': "Expand all" }
        %i.grcicon-wide-black
      %a.shrinkAll.btn.btn-mini{ 'href': "#", 'rel': "tooltip", 'title': "Collapse all" }
        %i.grcicon-normal-black

    .tab-content
      #directives.tab-pane
        %ul.tree-structure
      #controls.tab-pane
        %ul.tree-structure
